(function(){"use strict";BX.namespace("BX.Landing.Provider.Map");var e=BX.Landing.Utils.proxy;var t=BX.Landing.Utils.isPlainObject;var n=BX.Landing.Utils.isArray;var i=BX.Landing.Utils.isEmpty;var o=BX.Landing.Utils.isBoolean;var a={"":[],off:[{featureType:"road",stylers:[{visibility:"off"}]}]};var r={"":[],off:[{featureType:"administrative",elementType:"geometry",stylers:[{visibility:"off"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",stylers:[{visibility:"off"}]}]};var s={"":[],off:[{elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"administrative.land_parcel",stylers:[{visibility:"off"}]},{featureType:"administrative.neighborhood",stylers:[{visibility:"off"}]}]};BX.Landing.Provider.Map.GoogleMap=function(e){this.themes=BX.Landing.Provider.Map.GoogleMap.Theme;BX.Landing.Provider.Map.BaseProvider.apply(this,arguments)};BX.Landing.Provider.Map.GoogleMap.isApiLoaded=function(){return typeof google!=="undefined"};BX.Landing.Provider.Map.GoogleMap.prototype={constructor:BX.Landing.Provider.Map.GoogleMap,__proto__:BX.Landing.Provider.Map.BaseProvider.prototype,init:function(){var i=this.options;if(!t(this.mapOptions.center)||t(this.mapOptions.center)&&Object.keys(this.mapOptions.center).length===0){var l={lat:54.71916230318956,lng:20.48836888900491};if(n(this.mapOptions.markers)&&this.mapOptions.markers.length>0){var p=this.mapOptions.markers[0];if(t(p)&&t(p.latLng)&&Object.keys(p.latLng).length>0){l=Object.assign({},p.latLng)}}this.mapOptions.center=l}this.mapInstance=new google.maps.Map(this.mapContainer,{zoom:this.mapOptions.zoom,center:this.mapOptions.center,zoomControl:o(i.zoomControl)?i.zoomControl:true,mapTypeControl:o(i.mapTypeControl)?i.mapTypeControl:true,mapTypeControlOptions:t(i.mapTypeControlOptions)?i.mapTypeControlOptions:null,scaleControl:o(i.scaleControl)?i.scaleControl:true,streetViewControl:o(i.streetViewControl)?i.streetViewControl:true,rotateControl:o(i.rotateControl)?i.rotateControl:true,fullscreenControl:o(i.fullscreenControl)?i.fullscreenControl:true,styles:(i.theme&&i.theme in this.themes?this.themes[i.theme]:[]).concat(a[i.roads]||[],r[i.landmarks]||[],s[i.labels]||[])});if(this.mapOptions.markers){this.mapOptions.markers.forEach(function(e){e.editable=BX.Landing.getMode()==="edit";e.draggable=BX.Landing.getMode()==="edit";this.addMarker(e)},this)}this.mapInstance.addListener("click",this.onMapClickHandler);this.mapInstance.addListener("bounds_changed",e(this.onChange,this));this.mapInstance.addListener("center_changed",e(this.onChange,this));this.mapInstance.addListener("zoom_changed",e(this.onChange,this))},onChange:function(){this.onChangeHandler(this.preventChangeEvent)},addMarker:function(e){var t={};t.marker=new google.maps.Marker({position:e.latLng,map:this.mapInstance,draggable:e.draggable});t.form=BX.Landing.getMode()==="edit"?this.createBalloonEditForm(e,t):null;t.content=this.createBalloonContent(e);t.infoWindow=new google.maps.InfoWindow({content:e.editable&&BX.Landing.getMode()==="edit"?t.form.layout:t.content});if(e.showByDefault&&BX.Landing.getMode()!=="edit"){t.infoWindow.open(this.mapInstance,t.marker)}this.markers.add(t);t.marker.addListener("click",this.onMarkerClick.bind(this,t));this.onChange()},onMarkerClick:function(e){void(this.activeMarker&&this.activeMarker.infoWindow.close());e.infoWindow.open(this.mapInstance,e.marker);this.activeMarker=e},onEditFormRemoveClick:function(e){if(e){e.infoWindow.close();this.removeMarker(e)}this.markers.remove(e);this.onChange()},onEditFormApplyClick:function(e){e.infoWindow.close();this.onChange()},removeMarker:function(e){e.marker.setMap(null);this.markers.remove(e)},setZoom:function(e){this.mapInstance.setZoom(e)},setCenter:function(e){this.mapInstance.setCenter(e)},getMarkersValue:function(){return this.markers.map(function(e){return{title:e.form?e.form.fields[0].getValue():"",description:e.form?e.form.fields[1].getValue():"",showByDefault:e.form?!!e.form.fields[2].getValue()[0]:"",latLng:e.marker.position.toJSON()}})},getValue:function(){return{center:this.mapInstance.getCenter()?this.mapInstance.getCenter().toJSON():{},zoom:this.mapInstance.getZoom(),markers:this.getMarkersValue()}},setValue:function(e,o){this.preventChangeEvent=o;this.markers.forEach(this.removeMarker,this);if(t(e)){if(n(e.markers)){e.markers.forEach(this.addMarker,this)}if(!i(e.center)){this.setCenter(e.center)}if(!i(e.zoom)){this.setZoom(e.zoom)}}this.preventChangeEvent=false}}})();
//# sourceMappingURL=google-map.map.js